//
//  CustomAttributeCell.m
//  AmountBody
//
//  Created by Qiu Jishuai on 2018/1/4.
//  Copyright © 2018年 RCMTM. All rights reserved.
//

#import "CustomAttributeCell.h"
#import "Masonry.h"
@interface CustomAttributeCell()

@end

@implementation CustomAttributeCell

- (instancetype)initWithCoder:(NSCoder *)coder {
    self = [super initWithCoder:coder];
    if (self) {
        [self setup];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setup];
    }
    return self;
}

- (void)setAttributeSelected:(BOOL)attributeSelected {
    _attributeSelected = attributeSelected;
    UIImage *image = [UIImage imageNamed:@"colorXuan"];
    self.backgroundImageView.image = attributeSelected ? image : nil;
}


- (void)setup {

    UIImageView *imageView = [[UIImageView alloc] init];
    [self.contentView addSubview:imageView];
    self.imageView = imageView;
    [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(7, 7, 7, 7));
    }];

    UIImageView *backgroundImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:backgroundImageView];
    self.backgroundImageView = backgroundImageView;
    backgroundImageView.contentMode = UIViewContentModeScaleAspectFill;
    [backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(1, 1, 1, 1));
    }];
}

@end
